package com.huawei.gamebox.service.infoflow.card;

import android.content.Context;
import androidx.databinding.ViewDataBinding;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.appmarket.service.infoflow.cards.card.BaseInfoFlowCard;
import com.huawei.gamebox.service.infoflow.bean.InfoFlowGiftListCardBean;
import com.huawei.gamebox.service.welfare.gift.bean.GiftCardBean;
import java.util.ArrayList;
import java.util.List;
import o.ccz;
import o.chy;
import o.dof;
import o.ean;
import o.exr;
import o.eyh;
import o.fce;

public class InfoFlowGiftListCard extends BaseInfoFlowCard<exr> {
    private List<fce> ʽ;

    public /* synthetic */ void ˊ(ViewDataBinding viewDataBinding) {
        ॱ((exr) viewDataBinding);
    }

    public InfoFlowGiftListCard(Context context) {
        super(context);
    }

    public void ॱ(exr o_exr) {
        super.ˊ(o_exr);
        this.ʽ = new ArrayList(3);
        fce o_fce = new fce(this.ʼॱ, true, ccz.ॱ());
        o_fce.ˏ(o_exr.ˏ);
        this.ʽ.add(0, o_fce);
        o_fce = new fce(this.ʼॱ, true, ccz.ॱ());
        o_fce.ˏ(o_exr.ˋ);
        this.ʽ.add(1, o_fce);
        o_fce = new fce(this.ʼॱ, true, ccz.ॱ());
        o_fce.ˏ(o_exr.ॱ);
        this.ʽ.add(2, o_fce);
    }

    public void ˏ(CardBean cardBean) {
        super.ˏ(cardBean);
        if (cardBean instanceof InfoFlowGiftListCardBean) {
            InfoFlowGiftListCardBean infoFlowGiftListCardBean = (InfoFlowGiftListCardBean) cardBean;
            List ˊ = infoFlowGiftListCardBean.ˊ();
            if (ˊ != null) {
                for (int i = 0; i < this.ʽ.size(); i++) {
                    fce o_fce = (fce) this.ʽ.get(i);
                    if (i < ˊ.size()) {
                        CardBean cardBean2 = (GiftCardBean) ˊ.get(i);
                        cardBean2.ʽॱ(ean.ˎ(cardBean2));
                        cardBean2.ˋˋ(infoFlowGiftListCardBean.ॱˉ());
                        cardBean2.ʻ(true);
                        o_fce.ˏ(cardBean2);
                        o_fce.ˉ().setVisibility(0);
                    } else {
                        o_fce.ˉ().setVisibility(8);
                    }
                }
            }
        }
    }

    public ArrayList<String> ˊ() {
        ArrayList<String> arrayList = new ArrayList();
        if (this.ˊᐝ instanceof InfoFlowGiftListCardBean) {
            List ˊ = ((InfoFlowGiftListCardBean) this.ˊᐝ).ˊ();
            if (ˊ != null) {
                int i = 0;
                while (i < this.ʽ.size() && i < ˊ.size()) {
                    GiftCardBean giftCardBean = (GiftCardBean) ˊ.get(i);
                    arrayList.add(giftCardBean.ॱॱ() + "#$#" + giftCardBean.u_());
                    i++;
                }
            }
        }
        return arrayList;
    }

    public void ˊ(String str, String str2) {
        int i = 0;
        while (i < this.ʽ.size()) {
            GiftCardBean giftCardBean = (GiftCardBean) ((fce) this.ʽ.get(i)).ˌ();
            if (dof.ॱ(str) || !str.equals(giftCardBean.ᐝ()) || 2 == giftCardBean.ʼ()) {
                i++;
            } else {
                giftCardBean.ˎ(2);
                giftCardBean.ˏ(str2);
                eyh.ˏ();
                return;
            }
        }
    }

    public void ॱ(chy o_chy) {
        for (int i = 0; i < this.ʽ.size(); i++) {
            ((fce) this.ʽ.get(i)).ॱ(o_chy);
        }
    }
}
